<?php
include_once 'product.php';
include_once '../../include/Pager.class.php';
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>产品列表</title>
<link rel="stylesheet" type="text/css" href="../skin/css/base.css">
</head>
<body leftmargin="8" topmargin="8" background='../skin/images/allbg.gif'>

<form name="form1 ">

<table width="98%" border="0" cellpadding="2" cellspacing="1"
	bgcolor="#D1DDAA" align="center" style="margin-top: 8px">
	<tr bgcolor="#E7E7E7">
		<td height="24" colspan="9" background="skin/images/tbg.gif">&nbsp;产品列表&nbsp;</td>
		<td height="24" align="center" background="skin/images/tbg.gif"><a
			href="productAdd.php">新增产品</a></td>
	</tr>
	<tr align="center" bgcolor="#FAFAF1" height="22">
		<td width="6%">ID</td>
		<td width="10%">产品名称</td>
		<td width="10%">产品描述</td>
		<td width="10%">是否显示到首页</td>
		<td width="10%">是否显示为滚动</td>
		<td width="10%">产品小图</td>
		<td width="10%">产品大图</td>
		<td width="10%">新增时间</td>
		<td width="10%">修改时间</td>
		<td width="10%">操作</td>
	</tr>
	<?php
	$pager=new Pager();
	$pager->setPageSize(8);
	if (isset ($_GET ['page'] ) && !empty( $_GET ['page'] )){
		$pager->setCurrentPage($_GET ['page']);
	}
	else {
		$pager->setCurrentPage(1);
	}
	$pageIndex=$pager->getCurrentPage();
	$pageSize=$pager->getPageSize();	
	$list=list_product($pageIndex,$pageSize);
 
	if($list!=false){
		$pager->setRecorbTotal($list->totalCount);
		foreach ($list->items as  $catItem){
			?>

	<tr align='center' bgcolor="#FFFFFF"
		onMouseMove="javascript:this.bgColor='#FCFDEE';"
		onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
		<td><?=$catItem->id ?></td>
		<td align="left"><?=$catItem->product_name ?></td>
		<td align="left"><?=$catItem->product_desc?></td>		 
		<td align="left"><?=$catItem->show_home_page==1 ?"是":"否"?></td>
		<td align="left"><?=$catItem->show_as_scroll==1 ?"是":"否"?></td>
		<td align="left"><img src="<?=$catItem->product_small_picture?>"/></td>
		<td align="left"><img src="<?=$catItem->product_big_picture?>"/></td>
		<td align="left"><?=$catItem->product_add_time?></td>
		<td align="left"><?=$catItem->product_edit_time?></td>
		<td><a href="productEdit.php?id=<?=$catItem->id ?>">编辑</a> | <a
			href="productDel.php?id=<?=$catItem->id ?>">删除</a></td>
	</tr>

	<?php
		}
	}
	?>
	<tr>
		<td colspan="10" align="right"><?php 
			

		$pager->setBaseUri("productList.php?");
		echo $pager->execute();


		?></td>
	</tr>

</table>

</form>

</body>
</html>
